<?php
namespace Admin\Controller;
use Think\Controller;
class LinkController extends CommonController {
	public function index(){
		$model = D('link');
		$info = $model -> index();
		$this -> assign('link',$info);
		$this -> display();	
	}
	public function add(){
		$this -> display();	
	}
	public function addDo(){
		if(!IS_POST){
			$this ->error('非法提交数据');
			exit;
		}else{		
			$model = D('link');
			$info = $model -> addDo();
			if(false !== $info){
				$this -> success('添加成功',U('Link/index'));
			}else{
				$this -> error('添加失败');	
			}
		}		
	}
	public function edit(){
		$model = D('link');
		$info = $model -> edit();
		$this -> assign('cont',$info);
		$this -> display();	
	}
	public function editDo(){
		if(!IS_POST){
			$this ->error('非法提交数据');
			exit;
		}else{
			$model = D('link');
			$info = $model -> editDo();	
			if(true == $info){
				$this -> success('编辑成功',U('Link/index'));
			}else{
				$this -> error('编辑失败');	
			}			
		}
	}
	public function del(){
		if(!IS_GET){
			$this ->error('非法提交数据');
			exit;
		}else{
			$model = D('link');
			$info = $model -> del();	
			if(false !== $info){
				$this -> redirect('Link/index');
			}else{
				$this -> error('删除失败');	
			}	
		}	
	}
	public function sorts(){
		if(!IS_POST){
			$this ->error('非法提交数据');
			exit;
		}else{
			$model = D('link');
			$info = $model -> sorts();
			if(false !== $info){
				$this -> redirect('Link/index');
			}else{
				$this -> error('操作失败');
			}
		}
	}

}




